package cn.aitrox.ry.service.config.dao.impl;

import cn.aitrox.ry.common.dao.MapperSqlCallback;
import cn.aitrox.ry.common.dao.impl.BaseDaoImpl;
import cn.aitrox.ry.service.config.dao.ToolDao;
import cn.aitrox.ry.service.config.entity.ToolEntity;
import cn.aitrox.ry.service.config.mapper.ToolMapper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ToolDaoImpl extends BaseDaoImpl<ToolEntity> implements ToolDao {

    @Autowired
    private ToolMapper mapper;


    @Override
    public String maxValue() {
        return mapper.maxValue();
    }

    @Override
    public PageInfo<ToolEntity> search(Integer page, Integer pageSize, String likeName, List<String> valueList) {
        return searchByCustom(page, pageSize, new MapperSqlCallback<ToolEntity>() {
            @Override
            public List<ToolEntity> invoke() {
                return mapper.findByCond(likeName, valueList);
            }
        });
    }
}
